<?php


namespace Modules\Chinadmin\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\Auth;

/**
 * 账号模型
 */
class UserModel extends Authenticatable
{

    public $table = 'ca_user';
    public $primaryKey = 'id';

    protected $hidden = [
        'created_at',
        'updated_at',
    ];

    //加这个可以让时间成为正常格式。
    protected function serializeDate(\DateTimeInterface $date){
        return $date->format('Y-m-d H:i:s');
    }

    /**
     * @param string $guard
     * @return mixed
     */
    public static function getUserInfoByToken($token){
        $user = self::query()->where('token',$token)->first();
        return $user;
    }


}
